var $$ = Framework7.$;
var titles = ["身高","体重","胃围","腰围","臀围","腹围","大腿","小腿","手臂"];
var js = 0;
function stat(obj){
	var id = obj.href.substring(obj.href.indexOf("#") + 1);
	//去掉所有的active
	if(obj.innerHTML == "&gt;") {
		$$('#t1').text("<");
		for ( var i = 2; i < 5; i++) {
			$$('#t'+i).text(titles[i+4]);
		}
		$$('#t6').text("无");
		for ( var i = 1; i < 7; i++) {
			$$('#t'+i).attr("class","button tab-link");
		}
		return;
	}
	if(obj.innerHTML == "&lt;") {
		for ( var i = 1; i < 6; i++) {
			$$('#t'+i).text(titles[i]);
		}
		$$('#t6').text(">");
		for ( var i = 1; i < 7; i++) {
			$$('#t'+i).attr("class","button tab-link");
		}
		return;
	}
	$$('#'+id).html("<div id='main"+id+"' style='width: "+document.body.clientWidth+"px;height:300px;'></div>");
	 // 基于准备好的dom，初始化echarts实例
    var myChart1 = echarts.init(document.getElementById("main"+id));
    // 指定图表的配置项和数据
    option1 = {
			    title: {
			        text: ''
			    },
			    tooltip : {
			        trigger: 'axis'
			    },
			    legend: {
			        data:[obj.innerHTML]
			    },
			    
			    grid: {
			    	width:'90%',
			        left: '1%',
			        bottom: '3%',
			        containLabel: true
			    },
			    xAxis : [
			        {
			            type : 'category',
			            boundaryGap : false,
			            data : ['周一','周二','周三','周四','周五','周六','周日']
			        }
			    ],
			    yAxis : [
			        {
			            type : 'value'
			        }
			    ],
			    series : [
			        {
			            name:obj.innerHTML,
			            type:'line',
			            stack: '总量',
			            areaStyle: {normal: {}},
			            data:[120, 132, 101, 134, 90, 230, 210]
			        }
			    ]
			};
    
    // 使用刚指定的配置项和数据显示图表。
    myChart1.setOption(option1);
}